package Test.Control;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.Spinner;
import android.widget.LinearLayout.LayoutParams;

public class TestControlActivity extends Activity {
    /** Called when the activity is first created. */
	Button button1 ;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        button1 = (Button)findViewById(R.id.Button01);
        button1.setOnClickListener(new OnClickListener() {
        
			public void onClick(View v) {
				showPopupWindow();
				
			}
		});
    }
    
    private void createPopu(){
    	final PopupWindow pop = new PopupWindow(button1,300,300);
    	pop.setFocusable(true);
    //	pop.showAsDropDown(button1);
 
    }
    
    public void showPopupWindow() {   
        Context mContext = TestControlActivity.this;   
        LayoutInflater mLayoutInflater = (LayoutInflater) mContext   
             .getSystemService("layout_inflater");   
        View music_popunwindwow = mLayoutInflater.inflate(   
             R.layout.test1, null);   
        PopupWindow mPopupWindow = new PopupWindow(music_popunwindwow,   
             LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);   
        mPopupWindow.showAtLocation(findViewById(R.id.Button01), Gravity.CENTER, 0, 0);   
 }   

    
}